//
//  NSString+TGAttributedString.m
//  TongGuanLease
//
//  Created by 森鑫 on 2022/7/6.
//

#import "NSString+TGAttributedString.h"

@implementation NSString (TGAttributedString)


+ (NSAttributedString *)setParagraphText:(NSString*)text alignment:(NSTextAlignment)alignment space:(CGFloat)space {
    if(text == nil || text.length == 0){
        return nil;
    }
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:text];;
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
    paragraphStyle.alignment = alignment;
    [paragraphStyle setLineSpacing:space];
    [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, text.length)];
    return attributedString;
}

@end
